<!DOCTYPE html >
<html>
  
  <head>
    <meta charset="UTF-8">
    <title>企业员工管理-添加职称</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="static/css/font.css">
    <link rel="stylesheet" href="static/css/xadmin.css">
    <script type="text/javascript" src="static/js/jquery-3.3.1.js"></script>
    <script type="text/javascript" src="static/lib/layui/layui.js"></script>
    <script type="text/javascript" src="static/js/xadmin.js"></script>
  </head>
  
  <body>
    <div class="x-nav">
      <span class="layui-breadcrumb">
        <a >首页</a>
        <a >职称管理</a>
        <a>
          <cite>添加新职称记录</cite></a>
      </span>
      <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i></a>
    </div>
    <div class="x-body layui-anim layui-anim-up">
        <form class="layui-form" ><!--action="insertRankBonus.do" method="post">-->
            <div class="layui-form-item">
                <label for="Rank_name" class="layui-form-label">
                    <span class="x-red">*</span>职称名称
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="Rank_name" name="Rank_name" required=""
                           autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label for="Rb_bonus" class="layui-form-label">
                    <span class="x-red">*</span>对应奖金
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="Rb_bonus" name="Rb_bonus" required=""
                           autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
              <label  class="layui-form-label">
              </label>
              <button   class="layui-btn" lay-filter="add" lay-submit="" >
                  添加
              </button>
          </div>
      </form>
    </div>
    <script>

        layui.use(['form','layer'], function(){
            $ = layui.jquery;
          var form = layui.form
          ,layer = layui.layer;
          //监听提交
          form.on('submit(add)', function(data){
            console.log(data);
            //发异步，把数据提交
              $.ajax({
                  type: 'post',
                  url: 'insertRankBonus.do',
                  data: {
                      'bonus': $("#Rb_bonus").val(),
                      'name':$("#Rank_name").val()
                  },
                  success: function (result) {
                	  if(result.code==100){
                		  layer.alert("添加成功", {icon: 6},function () {
                              // 获得frame索引
                              var index = parent.layer.getFrameIndex(window.name);
                              //关闭当前frame
                              parent.layer.close(index);
                          });
                	  }else{
                		  layer.msg(result.message);
                	  }
                  },
                  error: function (err) {
                      alert("网络错误");
                  }
              });

            return false;
          });
        });
    </script>

  </body>

</html>